public class Test {
    // 生成随机数
    public static int getRandom() {
        double random = Math.random();
        int r = 100 + (int) (100 * random);
        return r;
    }

    // 检查随机数是否已经存在，存在返回true，否则返回false
    public static boolean isExist(int[] a, int random) {
        for (int i = 0; i < a.length; i++) {
            if (a[i] == random) return true;
        }
        return false;
    }

    public static int[] bornRandom() {
        // 随机生成100-200之间的，不同的60个随机数
        int[] a = new int[60];// 存放60个随机数
        for (int i = 0; i < a.length; i++) {
            while (true) {
                int random = getRandom();
                boolean isExist = isExist(a, random);
                if (isExist == false) {
                    a[i] = random;
                    break;
                }
            }
        }
        return a;
    }

    public static void main(String[] args) {
        int[] a = bornRandom();
         /* for (int i = 0; i < a.length; i++) {
            System.out.printf("%d：%d\n", i + 1, a[i]);
        }*/

        int i = 1;
        for (int item : a) {
            System.out.printf("%d：%d\n", i++, item);
        }
    }
}
